CentOS 5
Sponsored Link

Use several NICs on Domain U
  If your computer has more than 2 NICs, Domain0 uses them normally, but DomainU doesn't use them all by the default settings. Then, configure Xen and make DomainU be able to use several NIcs.

[1] Configure Xen
[root@ns ~]#
mv /etc/xen/scripts/network-bridge /etc/xen/scripts/network-bridge.xen

[root@ns ~]#
vi /etc/xen/scripts/network-bridge


#!/bin/sh
set -e

OP=$1
shift

script=/etc/xen/scripts/network-bridge.xen

case ${OP} in
   start)
       $script start vifnum=0 bridge=xenbr0 netdev=eth0
       $script start vifnum=1 bridge=xenbr1 netdev=eth1
       $script start vifnum=2 bridge=xenbri netdev=dummy0
       ;;

   stop)
       $script stop vifnum=0 bridge=xenbr0 netdev=eth0
       $script stop vifnum=1 bridge=xenbr1 netdev=eth1
       $script stop vifnum=2 bridge=xenbri netdev=dummy0
       ;;

   status)
       $script status vifnum=0 bridge=xenbr0 netdev=eth0
       $script status vifnum=1 bridge=xenbr1 netdev=eth1
       $script status vifnum=2 bridge=xenbri netdev=dummy0
       ;;

   *)
       echo 'Unknown command: ' ${OP}
       echo 'Valid commands are: start, stop, status'
       exit 1
esac


[root@ns ~]#
/etc/rc.d/init.d/xend restart

[root@ns ~]#
ifconfig | grep xenbr1

xenbr1 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
# xenbr1 has beed created like above


[root@ns ~]#
vi /etc/xen/www


# change like below

kernel
= "/boot/vmlinuz-2.6.18-8.1.1.el5xen"

ramdisk
= "/boot/initrd-2.6.18-8.1.1.el5xen.img"

memory
= "512"

name
= "www"

vcpus
= "2"

nicks
= "
2
"

vif
= [ 'mac=00:16:3e:00:00:11,bridge=xenbr0'
,
'mac=00:16:3e:00:00:21,bridge=xenbr1'
 ]

 
disk
= [ 'phy:Xen/www00,hda1,w',

'phy:Xen/www01,hda2,w',
'phy:Xen/www02,hda3,w',
'phy:Xen/www03,hda4,w',
'phy:Xen/www04,hda5,w' ]
root
= "/dev/hda1 ro"

extra
= "3"
[2] Make sure on DomainU that 2 Netowork interfaces working normally.
[root@www ~]#
ping 192.168.0.1

PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.857 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.342 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.342 ms

--- 192.168.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.342/0.513/0.857/0.244 ms

[root@www ~]#
ping 10.0.0.1

PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=4.48 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.417 ms
64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.416 ms

--- 10.0.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.416/1.771/4.480/1.915 ms
 
Tweet